#include <bits/stdc++.h>

using namespace std;

const int MAXN = 1e6+10;

int n,m,cnt[MAXN],sa[MAXN],rk[MAXN<<1],ork[MAXN],id[MAXN],px[MAXN];
char s[MAXN<<1];

int main (){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	scanf("%d",&n); int N = (n<<1)+1,m = 300;
	for(int i = 1;i <= n;i++) while(!isalpha(s[i] = getchar()));
	for(int i = 1;i <= n;i++) s[N-i+1] = s[i];
	for(int i = 1;i <= N;i++) ++cnt[rk[i] = s[i]];
	for(int i = 1;i <= m;i++) cnt[i] += cnt[i-1];
	for(int i = N;i >= 1;i--) sa[cnt[rk[i]]--] = i;
	for(int h = 1,p;h < N;h<<=1,m = p){
		p = 0;for(int i = N;i > N - h;i--) id[++p] = i;
		for(int i = 1;i <= N;i++) if(sa[i] > h) id[++p] = sa[i] - h;
		for(int i = 1;i <= m;i++) cnt[i] = 0;
		for(int i = 1;i <= N;i++) ++cnt[px[i] = rk[id[i]]];
		for(int i = 1;i <= m;i++) cnt[i] += cnt[i-1];
		for(int i = N;i >= 1;i--) sa[cnt[px[i]]--] = id[i];
		for(int i = 1;i <= N;i++) ork[i] = rk[i];
		p = 0;
		for(int i = 1;i <= N;i++)
			rk[sa[i]] = (ork[sa[i]] == ork[sa[i-1]] and ork[sa[i]+h] == ork[sa[i-1]+h])? p : ++p;
	}
	int l = 1,r = n,tt = 0;
	while(l <= r){
		if(rk[l] < rk[N-r+1]) printf("%c",s[l++]);
		else printf("%c",s[r--]);
		++tt; if(tt % 80 == 0) puts("");
	}
	return 0;
}

